package com.dd.dus.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dd.dc.entity.users.DLevelInfo;
import com.dd.dus.service.impl.DLevelInfoServiceImpl;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * VIP等级表 前端控制器
 * </p>
 *
 * @author JueDream
 * @since 2021-03-05
 */
@Slf4j
@RestController
@RequestMapping("/user/d-level-info")
public class DLevelInfoController {

    @Autowired
    DLevelInfoServiceImpl levelInfoService;

    @ApiOperation(value = "用户等级分页查詢接口")
    @PostMapping("/queryLevelList")
    public Page<DLevelInfo> queryLevelList(@RequestParam Integer page, @RequestParam Integer limit, @RequestParam String levelName){
        return levelInfoService.queryLevelList(page, limit, levelName);
    };

    @ApiOperation(value = "用户等级新增接口")
    @PostMapping("/insert")
    public Integer insert(@RequestBody DLevelInfo levelInfo){
        return levelInfoService.insert(levelInfo);
    };

    @ApiOperation(value = "用户等级更新接口")
    @PostMapping("/updateById")
    public boolean updateById(@RequestBody DLevelInfo levelInfo){
        return levelInfoService.updateById(levelInfo);
    };

    @ApiOperation(value = "用户等级删除接口")
    @PostMapping("/delete")
    public boolean delete(@RequestParam Integer levelId){
        return levelInfoService.removeById(levelId);
    };
}
